#include "cgihandle.h"
#include "cgiget.h"
#include "uci_for_cgi.h"



void main(void)
{
	char *cgistr;	
	xmlDoc		   *doc = NULL;
	xmlNodePtr     curNode;
	xmlNodePtr	   rootnode;
	int ret;
	cgistr = getCgiStr() + 5;  //skip "data="
	ctx=uci_alloc_context();
	if(cgistr == 0)
		return;

	//
	doc = xmlParseMemory(cgistr,strlen(cgistr));
	
	if(doc == NULL)
	{
		//WRONG
		goto main_error;
	}

	rootnode = xmlDocGetRootElement(doc);
	

	if(rootnode == NULL)
	{
		//WRONG
		xmlFreeDoc(doc);
		goto main_error;
	}

	ret = roothandle(rootnode);
	xmlFreeDoc(doc);
	
	
	
	
main_error:	
	
	freeCgiStr();
	//xmlFreeDoc(doc);
	
	uci_free_context(ctx);
}


